-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow updates, sorting for new row #714
Conversation
src/traits/SortableTrait.php
Outdated
$this->on(NgRestModel::EVENT_AFTER_UPDATE, [$this, 'swapIndex']); | ||
} | ||
|
||
public function swapIndex(AfterSaveEvent $event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method swapIndex
has 55 lines of code (exceeds 25 allowed). Consider refactoring.
src/traits/SortableTrait.php
Outdated
$this->on(NgRestModel::EVENT_AFTER_UPDATE, [$this, 'swapIndex']); | ||
} | ||
|
||
public function swapIndex(AfterSaveEvent $event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function swapIndex
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
var json = {}; | ||
json[fieldName] = newPosition; | ||
var pk = $scope.getRowPrimaryValue(row); | ||
$http.put($scope.config.apiEndpoint + '/' + pk +'?ngrestCallType=update&fields='+fieldName, angular.toJson(json, true)).then(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
src/traits/SortableTrait.php
Outdated
$this->on(NgRestModel::EVENT_AFTER_UPDATE, [$this, 'swapIndex']); | ||
} | ||
|
||
public function swapIndex(AfterSaveEvent $event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method swapIndex
has 65 lines of code (exceeds 25 allowed). Consider refactoring.
src/traits/SortableTrait.php
Outdated
$this->on(NgRestModel::EVENT_AFTER_UPDATE, [$this, 'swapIndex']); | ||
} | ||
|
||
public function swapIndex(AfterSaveEvent $event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function swapIndex
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
|
src/traits/SortableTrait.php
Outdated
$this->swapIndex($event, true); | ||
} | ||
|
||
protected function swapIndex(AfterSaveEvent $event, $isNewRecord = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method swapIndex
has 62 lines of code (exceeds 25 allowed). Consider refactoring.
src/traits/SortableTrait.php
Outdated
$this->swapIndex($event, true); | ||
} | ||
|
||
protected function swapIndex(AfterSaveEvent $event, $isNewRecord = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function swapIndex
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
* @param boolean $isNewRecord | ||
* @since 4.4.0 | ||
*/ | ||
protected function updateItemIndex(AfterSaveEvent $event, $isNewRecord = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function updateItemIndex
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
* @param boolean $isNewRecord | ||
* @since 4.4.0 | ||
*/ | ||
protected function updateItemIndex(AfterSaveEvent $event, $isNewRecord = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method updateItemIndex
has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Code Climate has analyzed commit 1296192 and detected 6 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 69.2% (50% is the threshold). This pull request will bring the total coverage in the repository to 57.0% (0.1% change). View more on Code Climate. |
Prototype for new sorting with custom input and sorting for paginated crud's